#!/bin/sh
set -e

case "$1" in
  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    if [ "$1" = "purge" ]; then
      if getent passwd freeswitch >/dev/null; then
        userdel freeswitch
      fi
      if getent group freeswitch >/dev/null; then
        groupdel freeswitch
      fi
      for x in \
        /var/lib/freeswitch \
        /var/log/freeswitch \
        /var/run/freeswitch;
      do
        rm -rf $x
      done
    fi
    ;;
  *)
    echo "postrm called with unknown argument \`$1'" >&2
    exit 1
    ;;
esac

#DEBHELPER#
exit 0
